/* 通用重置和盒模型设置 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden; /* 阻止横向滚动 */
  /* 确保 body 和 html 占据整个视口 */
  min-height: 100vh;
}

/* 移除 Vite 模板可能残留的 #root 样式 */
#root {
  width: 100%; /* 确保 #root 占满宽度 */
  margin: 0; /* 移除自动 margin */
  padding: 0; /* 移除默认 padding */
  text-align: center; /* 保留文本居中 */
}

/* 移除 Vite 模板默认样式 */
.logo,
.card,
.read-the-docs {
    display: none; /* 隐藏或移除不再需要的元素样式 */
}

@keyframes logo-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: no-preference) {
  /* a:nth-of-type(2) .logo { */
  /*   animation: logo-spin infinite 20s linear; */
  /* } */
}

.app {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden; /* 防止 Canvas 溢出 */
  background: linear-gradient(to bottom, #000000, #1a1a2e);
}

.content {
  position: relative;
  z-index: 1;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.text-container {
  text-align: center;
  margin-bottom: 4rem;
}

.text-container h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  background: linear-gradient(45deg, #00b4db, #0083b0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px rgba(0, 180, 219, 0.3);
}

.text-container p {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 2rem;
}

.start-button {
  background: linear-gradient(45deg, #00b4db, #0083b0);
  color: white;
  border: none;
  padding: 1rem 3rem;
  font-size: 1.2rem;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 20px rgba(0, 180, 219, 0.5);
  margin-top: 2rem;
  position: relative;
  overflow: hidden;
}

.start-button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(0, 180, 219, 0.8);
}

.start-button::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transform: rotate(45deg);
  transition: 0.5s;
}

.start-button:hover::after {
  left: 100%;
}

/* 响应式设计 */
@media (max-width: 768px) {
  h1 {
    font-size: 1.8rem;
  }

  p {
    font-size: 1rem;
  }

  .start-button {
    padding: 0.8rem 2rem;
    font-size: 1rem;
  }

  .text-container {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.5rem;
  }

  p {
    font-size: 0.9rem;
  }

  .start-button {
    padding: 0.7rem 1.8rem;
    font-size: 0.9rem;
  }

  .text-container {
    padding: 1rem;
  }
}

/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #1a1a2e;
  color: #ffffff;
}

/* 导航栏样式 */
.game-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: rgba(26, 26, 46, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  z-index: 1000;
  padding: 1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.game-nav ul {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.game-nav a {
  color: #ffffff;
  text-decoration: none;
  font-size: 1.1rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.game-nav a:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.game-nav a.active {
  background-color: rgba(255, 255, 255, 0.2);
}

/* 主应用容器 */
.app {
  min-height: 100vh;
  padding-top: 60px; /* 为导航栏留出空间 */
}

/* 游戏页面容器 */
.dna-game-page {
  position: relative;
  width: 100vw;
  height: calc(100vh - 60px); /* 减去导航栏高度 */
  overflow: hidden;
}

/* 游戏模块选择页面样式 */
.home-page {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s ease-out;
  visibility: hidden;
}

.module-grid.show {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.module-card {
  background: rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 1rem;
  padding: 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--card-color);
}

.module-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.15);
}

.module-card h2 {
  color: var(--card-color);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.module-card p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
  line-height: 1.5;
}

.module-card.disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.module-card.disabled:hover {
  transform: none;
  box-shadow: none;
}

.coming-soon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.8);
}

/* 响应式调整 */
@media (max-width: 768px) {
  .module-grid {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .module-card {
    padding: 1.5rem;
  }

  .module-card h2 {
    font-size: 1.3rem;
  }
}

/* 动画效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.module-card {
  animation: fadeIn 0.5s ease-out forwards;
}

.module-card:nth-child(2) {
  animation-delay: 0.1s;
}

.module-card:nth-child(3) {
  animation-delay: 0.2s;
}
